<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>亿乐购后台管理系统</title>
    <link rel="stylesheet" href="__PUBLIC__/admin/css/pintuer.css">
    <link rel="stylesheet" href="__PUBLIC__/admin/css/admin.css">
    <link rel="stylesheet" href="__PUBLIC__/admin/css/psubclass.css">
    <script src="__PUBLIC__/admin/js/jquery.js"></script>
    <script src="__PUBLIC__/admin/js/pintuer.js"></script>
    <script src="__PUBLIC__/admin/js/respond.js"></script>
    <script src="__PUBLIC__/admin/js/admin.js"></script>
    <script type="text/javascript">
	//获取所以大分类
    function getclassinfo(){
    	$.ajax( {    
    	    url:"{:U('admin/pclass/getclassinfo')}",// 跳转到 action    
    	    data:{},    
    	    type:'get',    
    	    dataType:'json',
    	    beforeSend:function(XMLHttpRequest){
    	    	$("#select").html("正在加载大分类信息,请等待！");
        	 },    
    	    success:function(data) {
          	    var pagehmtl="<select name='classid'>";
   	      		for(var i=0; i<data.length; i++)  
   	   		    {  
   		   		    pagehmtl+="<option value='"+data[i].id+"'>"+data[i].name+"</option>";  
   	   		    }
	      		pagehmtl+="</select>"
        	    $("#select").html(pagehmtl);      
    	     },    
    	     error : function() {
    	    	 $("#select").html("获取大分类信息失败，请刷新此页！");    
    	     }    
    	});
     }

	//分页ajax
    function ajaxpage($page){
    	$.ajax( {    
    	    url:"{:U('admin/psubclass/ajaxpage')}",// 跳转到 action    
    	    data:{
    	    	p:$page
    	    },    
    	    type:'get',    
    	    dataType:'json',
    	    beforeSend:function(XMLHttpRequest){
    	    	$("#ajaxpagedata").html("正在加载中。。。");
        	 },    
    	    success:function(data) {
				$("#ajaxpagehtml").html(data.show);
          	    var pagehmtl="<table class='table table-hover'><tr><th>子类名称</th><th>子类信息</th><th>子类图片</th><th>属于大类</th><th>编辑</th><th>删除</th></tr>";
				var list=data.list;
	      		for(var i=0; i<list.length; i++)  
	   		    {
		   		    pagehmtl+="<tr><th>"+list[i].name+"</th><th>"+list[i].info+"</th><th>"+list[i].pic+"</th><th>"+list[i].classid+"</th><th><a href='#'>编辑</a></th><th><a href='#'>删除</a></th></tr>";  
	   		    }
	      		pagehmtl+="</table>"; 
        	    $("#ajaxpagedata").html(pagehmtl);      
    	     },    
    	     error : function() {
    	    	 $("#ajaxpage").html('加载数据失败！');    
    	     }    
    	});
    }
    </script>
</head>

<body>
<div class="lefter">
    <div class="logo"><a href="#" ><img src="__PUBLIC__/admin/images/logo.png" alt="亿乐购后台管理系统" /></a></div>
</div>
<div class="righter nav-navicon" id="admin-nav">
    <div class="mainer">
        <div class="admin-navbar">
            <span class="float-right">
            	<a class="button button-little bg-main" href="{:U('admin/index/index')}" >前台首页</a>
                <a class="button button-little bg-yellow" href="{:U('admin/login/logout')}">注销登录</a>
            </span>
            <ul class="nav nav-inline admin-nav">
                <li><a href="{:U('admin/index/index')}" class="icon-home"> 开始</a>
                </li>
                <li><a href="{:U('admin/user/index')}" class="icon-shopping-cart"> 用户管理 </a>
                </li>
                <li class="active"><a href="{:U('admin/pclass/index')}" class="icon-shopping-cart"> 分类管理 </a>
					<ul><li><a style="font-weight:bold;" href="#" > 分类管理 </a></li><li><a href="{:U('admin/pclass/index')}"> 大分类 </a></li><li class="active"><a href="#"> 子分类  </a></li></ul>
                </li>
                <li><a href="{:U('admin/product/index')}" class="icon-shopping-cart"> 产品管理  </a>
                </li>
                <li><a href="{:U('admin/order/index')}" class="icon-shopping-cart"> 订单管理  </a>
                </li>
                <li><a href="{:U('admin/statistic/index')}" class="icon-shopping-cart"> 统计  </a>
                </li>
                <li><a href="{:U('admin/Channel/index')}" class="icon-shopping-cart"> 渠道管理  </a>
                </li>
            </ul>
        </div>
        <div class="admin-bread">
            <span>您好，<a style="color:red;">{$Think.session.user.name}</a> ，欢迎您的光临。</span>
            <ul class="bread">
                <li><a href="{:U('admin/index/index')}" class="icon-home"> 开始</a></li>
                <li>后台首页</li>
            </ul>
        </div>
    </div>
</div>

<div class="admin">

    <div class="tab">
      <div class="tab-head">
        <strong>子分类管理</strong>
        <ul class="tab-nav">
          <li class="active"><a href="#tab-set">添加子分类</a></li>
          <li><a href="#tab-email">编辑子分类</a></li>
        </ul>
      </div>
      <div class="tab-body">
        <br />
        <div class="tab-panel active" id="tab-set">
        	<form class="form-x" action="{:U('admin/psubclass/add')}" method="post" enctype="multipart/form-data">
	        	<div style="width:700px;">
		            <div class="form-group">
		            	<div class="label"><label for="title">子分类名称</label></div>
		                <div class="field field-icon-right">
		                    <input type="text" class="input" name="name" placeholder="子分类名称" data-validate="required:请填分类名称,length#>=5:名称长度不符合要求"/>
		                </div>
		            </div>
		            <div class="form-group">
		            	<div class="label"><label for="title">子分类介绍</label></div>
		                <div class="field field-icon-right">
		                    <input type="text" class="input" name="info" placeholder="介绍" data-validate="required:请填分类名称,length#>=5:名称长度不符合要求"/>
		                </div>
		            </div>
		            <div class="form-group">
		            	<div class="label"><label for="title">大分类</label></div>
		                <div class="field field-icon-right">
							<div id="select">
								<button onclick="getclassinfo()">点击我获取</button>
							</div>
		                </div>
		            </div>
	                <div class="form-group">
	                    <div class="label"><label for="logo">图片</label></div>
	                    <div class="field">
	                    	<a class="button input-file" href="javascript:void(0);">图片上传<input size="100" type="file" name="pic" data-validate="required:请选择上传文件,regexp#.+.(jpg|jpeg|png|gif)$:只能上传jpg|gif|png格式文件" /></a>
	                    </div>
                	</div>
		            <div class="form-button"><button type="sumbit" class="button bg-main" >提交</button></div>
				</div>
	        </form>
        </div>
        <div class="tab-panel" id="tab-email">
            <div id="ajaxpagedata"></div>
        	<div id="ajaxpagehtml">
				<button onclick="ajaxpage(1)">点击我获取数据</button>        	
        	</div>
        </div>
      </div>
    </div>
    <p class="text-right text-gray"><a class="text-gray" href="#">{:C('version')}</a></p>
</div>

</body>
</html>